<?php

header('Content-type:text/html;charset=utf-8');
getRunTime('start');

for ($i = 0; $i < 1000000; $i++) {

	$a = 'doudunwang';

}


getRunTime('end');

//获得时间差方法
function getRunTime($time) {

	static $times;

	if ($time == 'start') {
 
		$times = microtime(TRUE);

	} elseif ($time == 'end') {

		$ends = microtime(TRUE) - $times;

		echo '需要'.$ends .'秒完成';
	}

}
?>